/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mzm.ui.admin;

import java.awt.ComponentOrientation;
import java.util.List;
import org.jdesktop.swingx.combobox.ListComboBoxModel;

/**
 * 
 * @author daniel
 */
public class NewCategoryPanel extends javax.swing.JPanel {

	/**
	 * Creates new form NewCategoryPanel
	 */
	public NewCategoryPanel() {
		initComponents();
		parentsCombo.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
	}

	public void setParentsList(List<String> parents) {
		parentsCombo.setModel(new ListComboBoxModel<>(parents));
	}

	public String getParentCategory() {
		String cat = (String) parentsCombo.getSelectedItem();
		return cat;
	}

	public String getCategoryName() {
		return catNameTF.getText();
	}
	
	/**
	 * Clears the text box.
	 */
	public void clear(){
		catNameTF.setText("");
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		parentsCombo = new org.jdesktop.swingx.JXComboBox();
		catNameTF = new javax.swing.JTextField();
		jLabel2 = new javax.swing.JLabel();

		jLabel1.setText("קטגורית אב:");

		jLabel2.setText("שם קטגוריה:");

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
		this.setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup()
						.addGap(51, 51, 51)
						.addGroup(
								layout.createParallelGroup(
										javax.swing.GroupLayout.Alignment.LEADING, false)
										.addComponent(catNameTF,
												javax.swing.GroupLayout.DEFAULT_SIZE, 378,
												Short.MAX_VALUE)
										.addComponent(parentsCombo,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE))
						.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20,
								Short.MAX_VALUE)
						.addGroup(
								layout.createParallelGroup(
										javax.swing.GroupLayout.Alignment.LEADING)
										.addComponent(jLabel1,
												javax.swing.GroupLayout.Alignment.TRAILING)
										.addComponent(jLabel2,
												javax.swing.GroupLayout.Alignment.TRAILING))
						.addContainerGap()));
		layout.setVerticalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				layout.createSequentialGroup()
						.addGap(39, 39, 39)
						.addGroup(
								layout.createParallelGroup(
										javax.swing.GroupLayout.Alignment.LEADING)
										.addComponent(jLabel1)
										.addComponent(parentsCombo,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.PREFERRED_SIZE))
						.addGap(39, 39, 39)
						.addGroup(
								layout.createParallelGroup(
										javax.swing.GroupLayout.Alignment.BASELINE)
										.addComponent(catNameTF,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addComponent(jLabel2))
						.addContainerGap(107, Short.MAX_VALUE)));
	}// </editor-fold>//GEN-END:initComponents
		// Variables declaration - do not modify//GEN-BEGIN:variables

	private javax.swing.JTextField catNameTF;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel2;
	private org.jdesktop.swingx.JXComboBox parentsCombo;
	// End of variables declaration//GEN-END:variables
}
